Skip to content

feat(assets-controller): add snaps migration FF#9534

Open
Kriys94 wants to merge 1 commit into
mainfrom
feat/wpn-1489-stage-gated-ingestion-migration-networks
Open

feat(assets-controller): add snaps migration FF#9534
Kriys94 wants to merge 1 commit into
mainfrom
feat/wpn-1489-stage-gated-ingestion-migration-networks

Conversation

@Kriys94

@Kriys94 Kriys94 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Explanation

image

The AssetsController needs to take over assets ingestion (balances, metadata,
prices) for the non-EVM networks currently owned by their Snaps — Solana,
Stellar, and Tron — but this has to happen gradually and be reversible per
network. Previously the AssetsController/AccountsApiDataSource had no notion
of a per-network migration state: the Accounts API data source hardcoded an
eip155-only filter for the chains it surfaced as active, so there was no safe
way to stage the rollout or roll it back without a code change.
This PR adds stage-gated ingestion driven by the
RemoteFeatureFlagController, so the migration for each network can be advanced
and rolled back independently via LaunchDarkly:

  • A new snaps-assets-migration util module defines the per-network rollout
    model: the SnapsAssetsMigrationStage enum (OffReadAssetsControllerWithFallback
    ReadAssetsControllerWithoutFallbackReadAssetsControllerOnly), the
    per-network flag keys (networkAssetsSnapsMigrationSolana,
    networkAssetsSnapsMigrationStellar, networkAssetsSnapsMigrationTron), and
    helpers to resolve and evaluate a stage from remote feature flag state
    (parseSnapsAssetsMigrationStage, isMigrationStageActive,
    getSnapsAssetsMigrationNamespace, getMigrationStages, shouldSupportChain).
  • The AssetsController resolves each network's stage from
    RemoteFeatureFlagController state (read via the
    RemoteFeatureFlagController:getState messenger action). Migration networks
    are ingested (Account Activity WebSocket + Accounts API) only from
    ReadAssetsControllerWithFallback onward and left to the Snap when the stage
    is Off — which is also the fail-safe when the flag is missing or the
    controller is unavailable. Non-migration namespaces (e.g. eip155) are never
    gated.
  • The AccountsApiDataSource now gates the networks it surfaces as active
    chains on the same per-network stage (replacing the hardcoded eip155-only
    filter). It also subscribes to RemoteFeatureFlagController:stateChange
    (mirroring core-backend's AccountActivityService) so newly-enabled
    networks are picked up — and disabled ones dropped — without waiting for the
    periodic refresh. A selector reduces the flags to a primitive migration-stage
    signature so the handler only fires when a stage actually changes.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Changes which non-EVM chains Accounts API treats as active and can shift balance ingestion between Snaps and the controller at runtime via flags; hosts must allow the new messenger event on restricted messengers.

Overview
Introduces stage-gated rollout for moving Solana, Stellar, and Tron assets from Snaps into AssetsController, driven by per-network remote feature flags instead of a hardcoded eip155-only active-chain list.

A new snaps-assets-migration module defines SnapsAssetsMigrationStage (Off through ReadAssetsControllerOnly), flag keys (networkAssetsSnapsMigrationSolana / Stellar / Tron), and helpers to parse flags and decide whether a chain should be active. These types and helpers are re-exported from the package entrypoint for clients.

AccountsApiDataSource replaces the eip155: filter with shouldSupportChain: EVM chains stay always on; migration namespaces appear only when their stage is at least ReadAssetsControllerWithFallback (missing flags fail to Off). It subscribes to RemoteFeatureFlagController:stateChange with a migration-stage signature selector and refreshes active chains when a stage changes, without waiting for the periodic poll.

AssetsController widens allowed messenger events to include RemoteFeatureFlagController:stateChange so the data source can subscribe. @metamask/remote-feature-flag-controller is added as a direct dependency.

Reviewed by Cursor Bugbot for commit 355b70c. Bugbot is set up for automated code reviews on this repo. Configure here.

@Kriys94
Kriys94 force-pushed the feat/wpn-1489-stage-gated-ingestion-migration-networks branch 7 times, most recently from 34d00a8 to 2f2753c Compare July 17, 2026 08:49
@Kriys94
Kriys94 force-pushed the feat/wpn-1489-stage-gated-ingestion-migration-networks branch from 2f2753c to 355b70c Compare July 17, 2026 09:12
@Kriys94
Kriys94 marked this pull request as ready for review July 17, 2026 09:37
@Kriys94
Kriys94 requested review from a team as code owners July 17, 2026 09:37
@Kriys94
Kriys94 deployed to default-branch July 17, 2026 09:37 — with GitHub Actions Active
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant